package com.yzy.fly.entity.role;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yzy.fly.entity.core.FlySql;
import com.yzy.fly.util.BeanUtil;
import com.yzy.fly.util.DateUtil;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

@Data
@TableName("fly_component")
public class FlyComponent implements Serializable{

    @TableId(type = IdType.AUTO)
    private Integer id;

    private String label;
    private String name;
    private String fileName;
    private String packageName;
    private String type;//mapper,model
    private Integer systemId;
    private String descr;

    @DateTimeFormat(pattern= DateUtil.DateFormatPattern.yyyy_MM_dd_HH_mm_ss)
    @JsonFormat( pattern = DateUtil.DateFormatPattern.yyyy_MM_dd_HH_mm_ss )
    private Date createTime;
    @DateTimeFormat(pattern= DateUtil.DateFormatPattern.yyyy_MM_dd_HH_mm_ss)
    @JsonFormat( pattern = DateUtil.DateFormatPattern.yyyy_MM_dd_HH_mm_ss )
    private Date updateTime;

    public FlyComponent copy(){
        return copy(this);
    }

    public FlyComponent copy(FlyComponent oriFlyComponent){
        return BeanUtil.deepCloneObject(oriFlyComponent,this.getClass());
    }
    @TableField(exist = false)
    private List<FlySql> flySqls;


    @TableField(exist = false)
    private List<FlyComponent> depends;
    @TableField(exist = false)
    private Integer actId;

}
